<?php
namespace app\providers\command;

use Swoole\Server;
use help\SystemHelp;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use think\facade\Log;
use think\facade\Cache;
use think\facade\Route;
use help\EncryptionHelp;
use think\console\Input;
use phpseclib3\Crypt\RSA;
use think\console\Output;
use think\swoole\Manager;
use think\console\Command;
use app\listener\EmailTasks;
use app\resources\model\Nodes;
use think\console\input\Option;
use app\resources\model\UserFrp;
use app\resources\tasks\PushTask;
use app\resources\model\WebSocket;
use phpseclib3\Crypt\PublicKeyLoader;
use app\resources\service\NodeService;
// 命令  php think test

class TestCommand extends Command
{

    protected function configure()
    {
        // 指令配置
        $this->setName('test');
        // 设置描述
        $this->setDescription('测试接口');
    }

    protected function execute(Input $input, Output $output)
    {


        dump(  root_path().'bash/cmd.sh' );
       
        die;

        // $encrypt = EncryptionHelp::encryptString('dddd1214232432','node');
        // $encrypt = EncryptionHelp::decryptString($encrypt,'node2');
        // $node = Nodes::find(5);
        // // dump($node->getCmd());
        // $encData = openssl_encrypt('dddddd', 'DES-EDE3', str_pad('wfs', 24, '0'), OPENSSL_RAW_DATA);
        // info($encData);
        // dump($encData);
        die;


        // 生成端口
        // $path = app_path().md5(222).'.sh';
        // file_put_contents( $path ,222);

        // redis 使用列子
        // Cache::store('redis')->set('test',123);
        // $test = Cache::store('redis')->get('test');
        // dump($test);
        
        // sshCmd 发送ssh cmd指令
        // $host = "182.92.105.25";
        // $user = "root";
        // $password = "Aa605403358";
        // $cmd = <<<EOF
        //     echo '1' > /test
        // EOF;
        // $res = SystemHelp::sshCmd($host,$user,$password,$cmd);
        // if($res){
        //     dump('部署失败，请检查节点配置是否正确！');
        // }

        // 
        $output->writeln('成功!');
    }
}



